export interface ResponseData {
    status: number
    success?: {
        message: string
    }
    error?: {
        message: string
        code: number
    }
}


// 用于角钢入库的特殊接口 请求参数
export interface AngleSteelModel {
    code: string
}


// 用于角钢入库的特殊接口 返回参数
export interface AngleSteelModelResp extends ResponseData {
    data: {
        result: {id: number, code: string}[]
    }
}


// 物料分组 增删改查
type use_data_mode = 'create' | 'delete' | 'update' | 'read'
type record_json_type = {
    create: {
        code: string
        material_name: string
        model: string
        group: number
        set_piece: number
        theory_scatt_weight: number
    }
    delete: {
        id: number
    }
    update: {
        id: number
        code: string
        name: string
        model: string
        group: number
        set_piece: number
        theory_scatt_weight: number
    }
    read: {
        id: number
    }
}
type record_json_type1 = {
    create: {}
    delete: {}
    update: {}
    read: MaterialList
}
export type MaterialList = {
    id: number
    material_group_id: number
    code: string
    name: string
    model: string
    material_group_name: string
    set_piece: number
    operator_name: string
    enable: boolean
    operate_date_: string
    whole_piece: number
    scatt_piece: number
    weight: string
    theory_weight: string
    disable_whole_piece: number
    disable_scatt_piece: number
    disable_weight: string
    disable_theory_weight: string
    theory_scatt_weight: number
    latest_date_: string
    disable_latest_date_: string
}


// 物料分组增删改查 请求参数
export interface Material<T extends use_data_mode = use_data_mode> {
    param: record_json_type[T]
    mode: T
}


// 物料分组增删改查 返回参数
export interface MaterialCRUDResp<T extends use_data_mode = use_data_mode> extends ResponseData {
    date: record_json_type1[T]
}


// 物料 模糊搜索 请求参数
export interface MaterialFuzzySearch{
    enable: 'enable' | 'not_enable' | 'all'
    code: string | null
    material_name: string | null
    model: string | null
    material_group_id: number | null
    start: number
    stop: number
    usable_stock_mode: 'all' | 'zero' | 'not_zero'
    disable_stock_mode: 'all' | 'zero' | 'not_zero'
}


// 物料分组 模糊搜索 返回参数
export interface MaterialFuzzySearchResp extends ResponseData {
    data: {
        result: MaterialList[],
        total: number,
    }
}


// 物料调拨 请求参数
export interface Transfer{
    material_id: number
    handle_id: number
    mode: 'mode1' | 'mode2'
    weight: number
    whole_piece: number
    scatt_piece: number
    actual_date: string
}


// 物料调拨 返回参数
export interface TransferResp extends ResponseData {}
